﻿package com.dg.gaming.api.common.msg{
	import com.dg.gaming.api.common.*;
	import nanoxml.*;

	/**
	 * <p>Title: </p>
	 *
	 * <p>Description: </p>
	 *
	 * <p>Copyright: Copyright (c) 2009</p>
	 *
	 * <p>Company: </p>
	 *
	 * @author not attributable
	 * @version 1.0
	 */
	public class MsgTableConnect implements ITransmittable {
		private var table:Table;
		private var userName:String;


		public function MsgTableConnect(table:Table=null,userName:String=null,message:XMLElement=null) {
			this.table=table;
			this.userName=userName;
			if (message!=null) {
				this.table=new Table();
				this.table.initXML(message);
				this.userName=message.getStringAttribute(User.XML_ATT_USERNAME);
			}
		}

		public function flatten():XMLElement {
			var message:XMLElement=table.flatten();
			message.setAttribute(User.XML_ATT_USERNAME,userName);
			return message;
		}

		public function getTable():Table {
			return table;
		}

		public function getUserName():String {
			return userName;
		}
	}
}